<template>
  <div class="dashboard-editor-container">

    <panel-group @handleSetLineChartData="handleSetLineChartData" :inventory="inventory[0] === '暂无数据' ? 0 :inventory.length" :repair-time="repairTime[0] === '暂无数据' ? 0 : repairTime.length" />

    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">

     <div style="width: 80%;float: left;padding-bottom: 10px;">
       <line-chart :chart-data="lineChartData" />
     </div>

    </el-row>
  </div>
</template>

<script>
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'

const lineChartData = {
  newVisitis: {
    inputData: [100, 120, 161, 134, 105, 160, 165],
    outputData:  [200, 192, 120, 144, 160, 130, 140],
    lendData: [80, 100, 121, 104, 105, 90, 100]
  }
}

export default {
  name: 'Index',
  components: {
    PanelGroup,
    LineChart,
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis
    }
  },
  // activated(){
  //   this.getList();
  // },
  // created() {
  //   this.getList()
  // },
  methods: {
    // getList(){
    //   lineChartData.newVisitis.inputData = [100, 120, 161, 134, 105, 160, 165]
    //   lineChartData.newVisitis.outputData = [100, 120, 161, 134, 105, 160, 165]
    //   lineChartData.newVisitis.lendData = res.data[2]
    // },
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    }
  }
}
</script>

<style lang="scss" scoped>
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
